#!/bin/bash

source /etc/profile
appName=CavaSvrProxy
target=cava3svrproxy

function del()
{
    #rm -rf main 
    rm -rf ${target}
    rm -rf ${target}.tar.gz
}

del
go build -o ${appName} -mod=vendor main.go
#cp -rf main ${appName}
del

mkdir ${target}
cp -rf ${appName} ${target}
cp -rf config.xml ${target}
cp -rf start.sh ${target}
cp -rf stop.sh ${target}
cp -rf pem ${target}
git log -1 .. > ${target}/version.info

tar -czvf ${target}.tar.gz ${target}
rm -rf ${target}
rm -rf ${appName}

echo "pack ${appName} to ${target}.tar.gz succeed."
